﻿using QLNet;
using FinPlusComponents;
using p = FinPlusAnalytics.QLConvParser;
using u = FinPlusUtility.Utility;

namespace FinPlusAnalytics
{
    public class Index : FinPlusComponent
    {
       public string Name { get; private set; }
       public IborIndex IborIndex { get; private set; }

       //construct
       public Index(string marketName, string curveName, string name, string indexType, string tenor, string fixings = "")
       {

            Name = name;
            var market = Markets.Instance.GetMarket(marketName);
            market.SetIndex(name, p.Index(indexType, tenor, marketName, curveName));
    
            if(fixings != "") 
		    {
		        var fixs = (object[,])u.StringToArray2d(fixings);
		        //for each(f in fixs[1])
			    //    IborIndex.addFixing(Date(stoi(f[0])), stod(f[1]));
                //TODO
		    }
        }
    }
}
